/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistence;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

/**
 *
 * @author ceu
 */
@Entity
@Table(name = "prices")
@NamedQueries({
    @NamedQuery(name = "Prices.findAll", query = "SELECT p FROM Prices p")})
public class Prices implements Serializable {
    private static final long serialVersionUID = 1L;
    
   
    private Integer idPrices;
    private Integer poboxOrigin;
    private Integer poboxDestiny;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    private Double price;
    private TypePackage typePackage;

    public Prices() {
    }

    public Prices(Integer poboxOrigin, Integer poboxDestiny, TypePackage typePackage) {
        this.poboxOrigin = poboxOrigin;
        this.poboxDestiny = poboxDestiny;
        this.typePackage = typePackage;
    }
    
    
    

    @TableGenerator(
        name="pricesGen",
        table="JPA_WXS_APP_SEQUENCE_GENERATOR",
        pkColumnName="GEN_KEY",
        valueColumnName="GEN_VALUE",
        pkColumnValue="idprices",
        allocationSize=1,
        initialValue=0)
        @Id
    @GeneratedValue(strategy=GenerationType.TABLE,generator="pricesGen")
     @Column(name = "idprices", nullable = false)
     public Integer getIdPrices() {
        return idPrices;
    }

    public void setIdPrices(Integer idPrices) {
        this.idPrices = idPrices;
    }
   
    @Column(name = "pobox_origin")
    public Integer getPoboxOrigin() {
        return poboxOrigin;
    }

    public void setPoboxOrigin(Integer poboxOrigin) {
        this.poboxOrigin = poboxOrigin;
    }

    @Column(name = "pobox_destiny")
    public Integer getPoboxDestiny() {
        return poboxDestiny;
    }

    public void setPoboxDestiny(Integer poboxDestiny) {
        this.poboxDestiny = poboxDestiny;
    }

    @Column(name = "price")
    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    @JoinColumn(name = "type_package_id", referencedColumnName = "idtype_package", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    public TypePackage getTypePackage() {
        return typePackage;
    }

    public void setTypePackage(TypePackage typePackage) {
        this.typePackage = typePackage;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getIdPrices() != null ? getIdPrices().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Prices)) {
            return false;
        }
        Prices other = (Prices) object;
        if ((this.getIdPrices() == null && other.getIdPrices() != null) || (this.getIdPrices() != null && !this.getIdPrices().equals(other.getIdPrices()))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "persistence.Prices[ pricesPK=" + getIdPrices() + " ]";
    }
    
}
